package com.word;
class Course{
    private String courseID; //课程代号
    private String courseName;  // 课程名称
    private int credit;   //课程学分
    private String teacher;  // 任课老师

    public Course(){}  //默认的构造器

    public Course(String courseID) {    //单参数构造器
        this.courseID = courseID;
    }

    public Course(String courseID, String courseName) {//双参数构造器
        this(courseID);   //调用单参数构造器
        //this.courseID = courseID;
        this.courseName = courseName;
    }

    public Course(String courseID, String courseName, int credit) {  //三参数构造器
        this(courseID,courseName);   //调用两个参数构造器
        //this.courseID = courseID;
        //this.courseName = courseName;
        this.credit = credit;
    }

    public Course(String courseID, String courseName, int credit, String teacher) {  //四参数构造器
        this(courseID,courseName,credit);  //调用三个参数构造器
       /* this.courseID = courseID;
        this.courseName = courseName;
        this.credit = credit; */
        this.teacher = teacher;
    }

    public void setCourseID(String courseID) {
        this.courseID = courseID;
    }

    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }

    public void setCredit(int credit) {
        this.credit = credit;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public String getCourseID() {
        return courseID;
    }

    public String getCourseName() {
        return courseName;
    }

    public int getCredit() {
        return credit;
    }

    public String getTeacher() {
        return teacher;
    }
}
public class CourseText {
    public static void main(String[] args) {
        //创建一个长度为5 的数组
        String[] courseIDs = {"419001","419002","419003","419004","419005"};
        String[] courseNames = {"c语言程序设计","数据结构","计算机组成原理","Java语言程序设计","计算机操作系统"};
        int[] credits = {4,4,3,4,4};
        String[] teachers = {"张三","李四","王五","赵六","钱七"};
        //打印表头
        System.out.println("课程代码  课程名称      课程学分        任课老师");
        for (int i = 0; i < courseIDs.length; i++) {
            //格式化输出课程信息
            System.out.printf("%s\t%-10s\t%-10d\t%s\n",courseIDs[i],courseNames[i],credits[i],teachers[i]);
        }
    }
}
